package com.yfq.test;

import com.yfq.springframework.beans.DisposableBean;
import com.yfq.springframework.beans.annotation.Autowired;
import com.yfq.springframework.beans.annotation.Value;
import com.yfq.springframework.stereotype.Component;

/**
 * @author 姚凤桥
 * @date 2023/2/5 17:11
 * @description
 */
@Component("userService")
public class UserServiceImpl implements UserService, DisposableBean {
    @Value("${token}")
    private String token;

    @Autowired
    private UserDao userDao;

    @Autowired
    private UserService userService;

    @Override
    public String getUsername(String id) {
        return userDao.getUsername(id) + ":" + token;
    }

    @Override
    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("userService销毁...");
    }
}
